function ModuleDialogAddModel(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._object = (options && options.object) ? options.object : null;
  this._popupBox = (options && options.popupBox) ? options.popupBox : null;

  this._createElements();
};

ModuleDialogAddModel.prototype._createElements = function() {
  var unique = MiscUtils.unique(), _self = this;

  this._gui = new DialogAddModel(this._doc, this._container, this._width, this._height, this._user, this._date, this._options)._gui;
  this._gui.name.value = this._object.name;
  this._gui.name.onchange = function() { _self._object.name = this.value; };
  
  this._gui.add.onclick = function() { var args = { model: _self._object };
                                       new RequestUtils()._custom('addmodel', args, function(result, params) { if (result) { location.href = '?t=bmodel&i=' + result.id } }, {pos: DOMUtils.findPos(this)});
                                       _self._popupBox._close();
                                     };
  this._gui.cancel.onclick = function() { _self._popupBox._close(); };
};